package com.example.park2212.sign

import androidx.lifecycle.MutableLiveData
import com.example.lib_base.entity.SignBean
import com.example.lib_base.entity.SignBeanItem
import com.example.lib_base.mvvm.BaseViewModel
import com.example.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class SignViewModel @Inject constructor(val apiService: ApiService):BaseViewModel() {

    var getSignSuccess = MutableLiveData<SignBean>()
    fun getSignList(userId:Int){
        httpRequest({
            apiService.signList(userId)
        },getSignSuccess::postValue)
    }

    val signSuccess = MutableLiveData<SignBeanItem>()
    fun sign(item: SignBeanItem){
        httpRequest({apiService.sign(mapToBody(item))},signSuccess::postValue)
    }
}